//
//  NSDateFormatter+ACCommon.m
//  AcmedcareCore
//
//  Created by AcZx on 2018/3/12.
//

#import "NSDateFormatter+ACCommon.h"

@implementation NSDateFormatter (ACCommon)

+ (instancetype)sharedInstance
{
    static NSDateFormatter *formatter;
    static dispatch_once_t onceToken;
    
    dispatch_once(&onceToken, ^{
        formatter = [NSDateFormatter new];
        formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
    });
    
    return formatter;
}

+ (instancetype)shortsharedInstance
{
    static NSDateFormatter *formatter;
    static dispatch_once_t onceToken;
    
    dispatch_once(&onceToken, ^{
        formatter = [NSDateFormatter new];
        formatter.dateFormat = @"yyyy-MM-dd HH:mm";
    });
    
    return formatter;
}

+ (instancetype)currentDateInstance{
    static NSDateFormatter *formatter;
    static dispatch_once_t onceToken;
    
    dispatch_once(&onceToken, ^{
        formatter = [NSDateFormatter new];
        formatter.dateFormat = @"yyyyMMddHHmmssSSS";
    });
    
    return formatter;
}

+ (instancetype)currentYearMounthInstance{
    static NSDateFormatter *formatter;
    static dispatch_once_t onceToken;
    
    dispatch_once(&onceToken, ^{
        formatter = [NSDateFormatter new];
        formatter.dateFormat = @"yyyy-MM-dd";
    });
    
    return formatter;
}


+ (instancetype)currentMounthsInstance{
    static NSDateFormatter *formatter;
    static dispatch_once_t onceToken;
    
    dispatch_once(&onceToken, ^{
        formatter = [NSDateFormatter new];
        formatter.dateFormat = @"MM";
    });
    
    return formatter;
}

+ (instancetype)currentHoursAndMinitesInstance{
    static NSDateFormatter *formatter;
    static dispatch_once_t onceToken;
    
    dispatch_once(&onceToken, ^{
        formatter = [NSDateFormatter new];
        formatter.dateFormat = @"HH:mm";
    });
    
    return formatter;
}

+ (instancetype)currentWeeksInstance{
    static NSDateFormatter *formatter;
    static dispatch_once_t onceToken;
    
    dispatch_once(&onceToken, ^{
        formatter = [NSDateFormatter new];
        formatter.dateFormat = @"EEEE";
    });
    
    return formatter;
}


@end
